package controlador;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import patronDecorator.ControladorVentanaProducto;
import patronMementoo.ControladorCliente;
import Vista.NewJFramePrincipal;
public class ControladorPrincipal implements ActionListener{
	
   private NewJFramePrincipal principal;
   private String password1;
 
   
   public ControladorPrincipal() {
	   super ();	   
	   principal = new NewJFramePrincipal(this);
		principal.setVisible(true);		
		password1= "12345";
		principal.getjBtoOrden().addActionListener(new ActionListener() {
			
			
			@Override
			public void actionPerformed(ActionEvent e) {
				new ControladorOrden(null);			
			}			
		});
		
		principal.getjBtoAceptar().addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				if(principal.getjPsswPrincipal().getText().equals("12345")){
					
				
				principal.getjBtoReporteProductoCantidad().setEnabled(true);
				principal.getjBtoReporteIngredientes().setEnabled(true);
				principal.getjBtoReporteProductoMonto().setEnabled(true);
				principal.getjBtoIngredientesMasUsados().setEnabled(true);
				}
			}
		});
		
		principal.getjBtoSalir().addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				principal.dispose();
			}
		});
		   
		
		principal.getjPsswPrincipal().addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
			 if(!principal.getjPsswPrincipal().equals("12345")){				
				principal.getjBtoAceptar().setEnabled(true);			
			}			
			}			
		});
		
		principal.getjBtoRegistrarProducto().addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				new ControladorVentanaProducto(null);
			}		
		});
		principal.getjBtoRegistrarCategoria().addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				new ControladorCtegoria(null);			
			}			
		});
		
		principal.getjBtoRegistrarCliente().addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				(new ControladorCliente()).mostrar();
			}
			
		});
		principal.getjBtoRegistrarPlantilla().addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				new ControladorPlantilla(null);
			}			
		});
		principal.getjBtoCompra().addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
				new ControladorDetalle(null);
			}			
		});
		principal.getJBtoRegistrarIngre().addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				(new ControladorIngrediente()).mostrar();
			}
		});
		principal.getjBtoReporteProductoMonto().addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
			new ControladorReporteProdMonto(null);
			}
			
		});
		principal.getjBtoReporteProductoCantidad().addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent e) {
			new ControladorProductoCantidad(null);
			}
			
		});
		
		principal.getjBtoReporteIngredientes().addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				new ControladorReporteIngrediente(null);
			}
		});
   }
private NewJFramePrincipal NewJFramePrincipal() {
	// TODO Auto-generated method stub
	return null;
}
@Override
public void actionPerformed(ActionEvent e) {
	// TODO Auto-generated method stub
	
}

}
